package com.gmq.chapter01.yield;

/**
 * Created by gmq on 2017/08/10.
 *
 * @version 1.0
 * @since 2017/08/10 16:33
 */
public class MyThread extends Thread {

    @Override
    public void run() {

        long beginTime = System.currentTimeMillis();
        int count = 0;
        for (int i = 0; i < 5000000; i++) {
            //Thread.yield();
            count = count + (i + 1);
        }
        long endTime = System.currentTimeMillis();
        System.out.println(" 用时： " + (endTime - beginTime) + " 秒！");
    }
}
